package com.lyf.scm.plan.api.controller;

import com.lyf.scm.plan.api.dto.OtherTargetEchartResultDTO;
import com.lyf.scm.plan.api.dto.OtherTargetGeneralQueryDTO;
import com.lyf.scm.plan.api.dto.OtherTargetResultDTO;
import com.lyf.scm.plan.domain.service.OtherTargetGeneralService;
import com.rome.arch.core.clientobject.Response;
import com.rome.arch.util.controller.RomeController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.annotation.Resource;
import java.util.List;

/**
 * 其它指标通用处理类
 *
 * @author wangchlei
 * @date 2020/11/12
 */
@Slf4j
@Api(tags = "其它指标通用处理类")
@RequestMapping("/api/v1/otherTargets")
@RomeController
public class OtherTargetGeneralContrller {
    @Resource
    private OtherTargetGeneralService otherTargetGeneralService;

    @PostMapping("/query")
    @ApiOperation(value = "查询")
    public Response<List<OtherTargetResultDTO>> getNecessaryOtherTargets(@RequestBody OtherTargetGeneralQueryDTO otherTargetGeneralQueryDTO) {
        return Response.builderSuccess(otherTargetGeneralService.getNecessaryOtherTargets(otherTargetGeneralQueryDTO));
    }

    @PostMapping("/echartQuery")
    @ApiOperation(value = "查询图表指标")
    public Response<List<OtherTargetEchartResultDTO>> getEchartNecessaryOtherTargets(@RequestBody OtherTargetGeneralQueryDTO otherTargetGeneralQueryDTO) {
        return Response.builderSuccess(otherTargetGeneralService.getEchartNecessaryOtherTargets(otherTargetGeneralQueryDTO));
    }
}
